var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
import React, { useContext, useState, useEffect } from "react";
import Taro from "@tarojs/taro";
var defalut = [];
var CountyDataContext = React.createContext({});
export var useCountyDataContext = function () { return useContext(CountyDataContext); };
var GreetProvider = function (props) {
    var _a = __read(useState(defalut), 2), countyData = _a[0], setCountyData = _a[1];
    useEffect(function () {
        Taro.request({
            url: "https://cdn.yryz.com/lovelorn/file/countryData.json",
            success: function (res) {
                setCountyData(__spread(res.data));
            }
        });
    }, []);
    return (React.createElement(CountyDataContext.Provider, { value: { countyData: countyData } }, props.children));
};
export default GreetProvider;
